package chapter2.No2_3_volatile关键字.a关键字volatile与死循环.demo2;

/**
 * *：线程停不下来是因为死循环导致后面的程序执行不了
 * Created by Administrator on 2016/11/15.
 */
public class Main {

    public static void main(String[] args) throws InterruptedException {
        ServiceClass sc = new ServiceClass();
        MyThread a = new MyThread(sc);
        a.setName("a");
        a.start();

        Thread.sleep(2000);
        System.out.println("我要开始停止线程了："+Thread.currentThread().getName());
        sc.setStop(false);
    }

}
